import request from '../utils/request'

/**
 * 生成短链接
 */
export function generateShortLink() {
  return request.ajax({
    url: '/distribution/su/get-short-url',
    method: 'post',
    needToken: true
  })
}
//生成荣耀里的短链接
export function generateRShortLink() {
  return request.ajax({
    url: '/distribution/su/get-short-old-url',
    method: 'post',
    needToken: true
  })
}

/**
 * 访问短链接
 * @param params
 */
export function accessShortLink(params) {
  return request.ajax({
    url: '/distribution/su/visit',
    method: 'get',
    params
  })
}

/**
 * 生成小程序码
 * @param params
 */
export function getMiniprogramCode(params) {
  return request.ajax({
    url: '/passport/mini-program/code-unlimit',
    method: 'get',
    needToken: true,
    params
  })
}

/**
 * 获取我的推荐人
 */
export function getMyRefereer() {
  return request.ajax({
    url: '/distribution/recommend-me',
    method: 'get',
    needToken: true
  })
}

/**
 * 获取推荐人列表
 */
export function getRefereeList() {
  return request.ajax({
    url: '/distribution/lower-list',
    method: 'get',
    loading: true,
    needToken: true
  })
}

/**
 * 获取与我相关的结算单信息
 * @param params
 */
export function getSettlementTotal(params) {
  return request.ajax({
    url: '/distribution/bill/member',
    method: 'get',
    needToken: true,
    params
  })
}

/**
 * 获取与我相关的订单信息
 * @param params
 */
export function getRelevantList(params) {
  return request.ajax({
    url: '/distribution/bill/order-list',
    method: 'get',
    needToken: true,
    params
  })
}

/**
 * 获取与我相关的退款单信息
 * @param params
 */
export function getRelevantRefundList(params) {
  return request.ajax({
    url: '/distribution/bill/sellback-order-list',
    method: 'get',
    needToken: true,
    params
  })
}

/**
 * 获取我的历史业绩
 * @param params
 */
export function getMyHistoryList(params) {
  return request.ajax({
    url: '/distribution/bill/history',
    method: 'get',
    needToken: true,
    params
  })
}

/**
 * 获取提现银行卡列表
 */
export function getWithdrawalsParams() {
  return request.ajax({
    url: '/distribution/withdraw/params',
    method: 'get',
    needToken: true
  })
}
/**
 * 阿里开放接口，获取银行卡信息
 */
export function checkBankCard(cardNo) {
  return request.ajax({
    url: `https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&cardNo=${cardNo}&cardBinCheck=true`,
    method: 'get',
    needToken: true
  })
}
/**
 *修改银行卡
 */
export function updateWithdrawalsParams(data) {
  return request.ajax({
    url: '/distribution/withdraw/params',
    method: 'post',
    needToken: true,
    data
  })
}
/**
 * 添加银行卡
 */
export function addWithdrawalsParams(data) {
  return request.ajax({
    url: '/distribution/withdraw/params',
    method: 'put',
    needToken: true,
    data
  })
}

/**
 * 保存提现设置
 * @param params
 */
export function reserveWithdrawalsParams(params) {
  return request.ajax({
    url: '/distribution/withdraw/params',
    method: 'put',
    needToken: true,
    params
  })
}

/**
 * 申请提现
 * @param params
 */
export function applyWithdrawals(params) {
  return request.ajax({
    url: '/distribution/withdraw/apply-withdraw',
    method: 'post',
    needToken: true,
    params
  })
}

/**
 * 获取可提现金额
 */
export function getWithdrawalsCanRebate() {
  return request.ajax({
    url: '/distribution/withdraw/can-rebate',
    method: 'get',
    needToken: true
  })
}

/**
 * 获取提现记录
 * @param params
 */
export function getWithdrawalsList(params) {
  return request.ajax({
    url: '/distribution/withdraw/apply-history',
    method: 'get',
    needToken: true,
    params
  })
}
/**
 * 获取我的公域养老团队
 * @param params
 */
export function getMyTeam(shop_id) {
  return request.ajax({
    url: shop_id ? '/distribution/lower-listSy/' + shop_id : '/distribution/lower-listGy',
    method: 'get',
    needToken: true,
  })
}
/**
 * 获取公域养老已分润待分润金额
 *
 */
// 这是测试
export function getFenRun(shop_id) {
  return request.ajax({
    url: shop_id ? '/distribution/bill/fenrun-sy/' + shop_id : '/distribution/bill/fenrun-gy',
    method: 'get',
    needToken: true,
  })
}
/**
 * 记录公域养老分润明细 is_withdrawr  0/1
 * @param params
 */
export function getFenRundetail(ispublic, params) {
  return request.ajax({
    url: ispublic ? '/distribution/bill/order-old-gy' : '/distribution/bill/order-old-sy',
    method: 'get',
    needToken: true,
    params
  })
}
/**
 * 获取所有待分润详细列表
 * @param params
 */
export function getAllFenRun(params) {
  return request.ajax({
    url: `/distribution/bill/old-order-list`,
    method: 'get',
    needToken: true,
    params
  })
}
/**
 * 获取总计-分润待分润金额
 * @param 
 */
export function getFenrun() {
  return request.ajax({
    url: `/distribution/bill/fenrun-tatol`,
    method: 'get',
    needToken: true,
  })
}

/**
 * 获取推广已分润和待分润详细订单信息
 * @param params  is_withdraw  0待分润   1已分润
 */
export function getPromoteDetails(params) {
  return request.ajax({
    url: '/distribution/bill/app-order-list',
    method: 'get',
    needToken: true,
    params
  })
}

/**
 * 获取推广已分润和待分润
 * @param params
 */
export function getPromote() {
  return request.ajax({
    url: '/distribution/bill/fenrun-tuiguang',
    method: 'get',
    needToken: true,
  })
}
//获取粉丝，铁粉
export function getFans(params) {
  return request.ajax({
    url: '/distribution/fans-count',
    method: 'get',
    needToken: true,
    params
  })
}
/* 获取我的 粉丝列表 */
export function getFansList(params) {
  return request.ajax({
    url: '/distribution/get-fans',
    method: 'get',
    needToken: true,
    loading: false,
    params
  })
}
/* 获取缘分设置 */
export function getYuanFansSettings() {
  return request.ajax({
    url: '/distribution/settings-fans',
    method: 'get',
    needToken: true,
    loading: false,
  })
}

/* 缘粉统计 */
export function getYuanFansCount() {
  return request.ajax({
    url: '/distribution/yuan-fans-count',
    method: 'get',
    needToken: true,
    loading: false,
  })
}
/* 获取我的缘粉 */
export function getYuanFans(params) {
  return request.ajax({
    url: '/distribution/get-yuan-fans',
    method: 'get',
    needToken: true,
    loading: false,
    params
  })
}

/* /distribution/surplus/money-list
个人收入支出列表 */

export function getMoneyList(params) {
  return request.ajax({
    url: '/distribution/surplus/money-list',
    method: 'get',
    needToken: true,
    loading: false,
    params
  })
}
export function getAmount() {
  return request.ajax({
    url: `/distribution/withdraw/can-rebate`,
    method: 'get',
    needToken: true,
  })
}
/* 
统计收入支出 */
export function getMoneySum() {
  return request.ajax({
    url: '/distribution/surplus/money-sum',
    method: 'get',
    needToken: true,
    loading: false,
  })
}
/* 
月账单 */
export function getStatisticsBill() {
  return request.ajax({
    url: '/distribution/statistics/bill',
    method: 'get',
    needToken: true,
    loading: false,
  })
}
/* 
月分润 */
export function getStatisticsDistribution() {
  return request.ajax({
    url: '/distribution/statistics/distribution',
    method: 'get',
    needToken: true,
    loading: false,
  })
}
/* 获取获取分享图以及分享标语 */
export function getsharemessage(shop_id) {
  return request.ajax({
    url:`/shops/shareImageTitle/${shop_id}`,
    method:'get',
    needToken: true,
    loading:false,
  })
}







